package com.sky.controller.admin;

import com.sky.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("/admin/common")
@Slf4j
public class CommonController {


    @PostMapping("/upload")
    public Result<String> upload(MultipartFile file){
        log.info("文件上传:file就是上传的文件！");
        log.info("文件的原始名字:"+file.getOriginalFilename());
        try {
            log.info("文件的字节数:"+file.getBytes().length);
        } catch (IOException e) {
            e.printStackTrace();
        }

        return Result.success("a.jpg");
    }

}
